home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1991 / Jan 91 / MacApp.Tech$ 1⁄11⁄91 / 2634-Re[2] Pascal '9x(was-Jan91 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.3 KB  |  50 lines  |  [TEXT/GEOL]

  1. Item    2645350                         10-Jan-91        14:46PST
  2.  
  3. From:   BERDAHL                         Amoco Tech, Eric Berdahl,VAR
  4.  
  5. To:     DEREK                           White, Derek
  6.         MACAPP.TECH$                    MacApp Technical
  7.  
  8. ------------------------------------------------------------------------------
  9.  
  10. Sub:    Re[2]:Pascal '9x(was Pascal++)
  11.  
  12. Derek,
  13.  
  14. Pardon me for inserting some stock into this already brewing stew, but there
  15. are some trains simply must be stepped in front of.
  16.  
  17. I agree with your concept of returning references not being necessary in
  18. Pascal, as the central issues the feature addresses are already dealt with.
  19. However, your comments, “At the implementation level there is no difference
  20. between returning a C++ reference and a C++ pointer.  The Object Pascal
  21. interfaces to a C++ routine would just show a pointer being returned instead of
  22. a reference.”, are misleading.  At the compiler implementation level, there is
  23. a big difference between returning a C++ reference and a C++ pointer.  At the
  24. source code level, there may or not be a difference, depending on how you wish
  25. to treat the problem.
  26.  
  27. The syntactic sugar C++ does to return a reference is like this: The calling
  28. function constructs a temporary variable.  A pointer to this temp is pushed on
  29. the stack and the invoked routine actually (at the assembly level) acts on the
  30. temp in the stack frame of the calling function (hence, we really don’t need to
  31. worry about copy constructors when references are returned).  The function
  32. itself returns nothing.  Got that?  Ok, now returning a pointer is different.
  33. In this case, no temp exists and the function really returns a pointer.  See
  34. the difference?  This discussion assumes the use of AT&Ts C++ compiler.  Unless
  35. you intend to change this situation, Pascal will need to differentiate between
  36. C++ references and pointers.
  37.  
  38. I also wish to thank you for clearly noting one of the intentions of the Pascal
  39. '9x project: to have greater support for C++ linkage.  Personally, I thought
  40. Pascal++ was a poor name, given what I’ve seen, Eiffel-- would be more
  41. appropriate, but I digress.  The C++ world has lots of neat stuff to offer the
  42. development community, and I’m very happy that we’ll be able to share it with a
  43. wider audience.
  44.  
  45. Still stirring,
  46. Eric Berdahl
  47. Amoco Technology Company
  48. AppleLink:  BERDAHL
  49.  
  50.